<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <title>单页管理-文章列表</title>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <script type="text/javascript" src="__PUBLIC__/statics/js/jQuery.v1.11.1.js"></script>
    <script type="text/javascript" src="__PUBLIC__/statics/bootstrap/js/bootstrap.min.js"></script>
    <link rel="stylesheet" href="__PUBLIC__/statics/bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="__PUBLIC__/admin/css/base.css">
    <script type="text/javascript" src="__PUBLIC__/statics/layer/layer.js"></script>
    <script type="text/javascript" src="__PUBLIC__/admin/js/common.js"></script>
</head>

<body>
    <div id="main">
        <ol class="breadcrumb">
            <li><a href="{:U('Index/main')}"><span class="glyphicon glyphicon-home"></span></a></li>{$breadcrumb}
        </ol>
        <div class="row">
            <div class="col-md-12">
                <div class="panel panel-default">
                    <div class="panel-heading">
                        <!-- {$other_action} -->
                        文章列表&nbsp;&nbsp;
                        <a href="{:U('Article/add',array('cid'=>$_GET['id'],'model_id'=>$_GET['model_id']) )}" class="btn btn-primary btn-xs btn_add">添加文章</a>
                    </div>
                    <form>
                        <div class="panel-body">
                            <div class="table-responsive">
                                <table class="table table-striped table-bordered table-hover">
                                    <thead>
                                        <tr>
                                            <th width="40">选择</th>
                                            <th width="55">排序</th>
                                            <th width="100">ID</th>
                                            <th>标题</th>
                                            <th width="150">发布时间</th>
                                            <th width="10%">操作</th>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <volist name="list" id="vo">
                                            <tr>
                                                <td>
                                                    <input type="checkbox" value="{$vo.id}" name="arc_id[]" class="arc_id" />
                                                </td>
                                                <td>
                                                    <input type='text' name="art_order[{$vo['id']}]" class='form-control input-sm' value='{$vo.art_order}' />
                                                </td>
                                                <td>{$vo.id}</td>
                                                <td>{$vo.title}</td>
                                                <td>{$vo['add_time']|date="Y-m-d H:i:s", ###}</td>
                                                <td>
                                                    <a href="{:U('update',array('id'=>$vo['id'],'cid'=>$_GET['id']))}">编辑</a>
                                                    <a href='' class='ajax-get' data-url="{:U('delete',array('id'=>$vo['id'],'cid'=>$_GET['id']))}" data-location='reload' data-confirm='确定要删除【{$vo.title}】这篇文章吗?'>删除</a>
                                                </td>
                                            </tr>
                                        </volist>
                                        <empty name="list">
                                            <tr>
                                                <td colspan="6" align="center">
                                                    暂无数据
                                                </td>
                                            </tr>
                                        </empty>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                        <notempty name="list">
                            <div class="panel-heading">
                                <label class="checklabel"><input class="allcheck" type="checkbox" value="" name="" />全选</label>
                                <a class="btn btn-primary btn-xs ajax-post" data-url="__SELF__" data-location="reload" data-modal="false">排序</a>
                                <a class="btn btn-primary btn-xs copy" data-modal="false">推送</a>
                                <a href="javascipt:void(0)" class='ajax-post btn btn-primary btn-xs' data-url="{:U('delete',array('cid'=>$_GET['id']))}" data-location='reload' data-confirm='确定要删除选中文章吗?'>删除</a>
                            </div>
                        </notempty>
                        <notempty name="page">
                            <div class="page">
                                <ul class="pagination">{$page}</ul>
                            </div>
                        </notempty>
                    </form>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade modal-alert" tabindex="-1" role="dialog">
        <div class="modal-dialog">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                    <h4 class="modal-title" id="myModalLabel">提示</h4>
                </div>
                <div class="modal-body">
                    <div class="alert-status loading">
                        <div class="status">Loading...</div>
                        <div class="alert-msg">正在提交数据请稍后...</div>
                    </div>
                    <div class="alert-status success">
                        <div class="status glyphicon glyphicon-ok"></div>
                        <div class="alert-msg">提交成功</div>
                    </div>
                    <div class="alert-status error">
                        <div class="status glyphicon glyphicon-remove"></div>
                        <div class="alert-msg">提交失败请重试</div>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default btn-sm" data-dismiss="modal">关闭</button>
                    <a class="btn btn-primary btn-sm callback-location" href="">&nbsp;</a>
                    <a class="btn btn-primary btn-sm" href="{$Think.SERVER.HTTP_REFERER}">返回上一页</a>
                </div>
            </div>
        </div>
    </div>
    <div class="copyCate">
        <select multiple class="form-control copy_tree" style="height:500px" name="cid">
            {$tree}
        </select>
    </div>
    <script>
    $('.copy').on('click', function() {
        var arc_id = [];
        $('.arc_id:checked').each(function(i,v){
            arc_id.push($(v).val());
        });
        if (arc_id.length > 0) {
            layer.open({
                type: 1,
                title: '请选择要推送的栏目',
                shadeClose: true,
                skin: 'layui-layer-lan',
                area: '500px',
                content: $('.copyCate'),
                btn: ['取消', '确定'],
                  no: function(index, layero){
                  },btn2: function(index, layero){
                    $.ajax({
                        type: 'post',
                        url: '{:U("copy")}',
                        data: {
                            clone_id : arc_id,
                            cid : $('.copy_tree').val(),
                            nid : {$Think.get.id}
                        },
                        dataType:'json',
                        success: function(result) {
                            $('.modal-alert').modal('show');
                            ajaxResultDo(result, 'reload', '');
                            return false;
                        }
                    });
                  },cancel: function(){
                    //右上角关闭回调;return false 开启该代码可禁止点击该按钮关闭
                  }
            });
        } else {
            $('.modal-alert').modal('show');
            var result = new Array();
            result.status = false;
            result.msg = '请选择要推送的文章';
            ajaxResultDo(result, '', '');
            return false;
        }
    });
    </script>
</body>

</html>
